class HelloWorldGroovy {

    static main(args) {

        def value = "Hello World"
        println value
        println value.class

        def num = 110
        println num
        println num.class //int

        num = "深思君"
        println num

        println "----------------------------------------"

        for(j in 0..<5){
            println j
        }
        for(z in 0..4){
            println z
        }
        println 0..4 instanceof Collection

        println "----------------------------------------"

        def array = ["Groovy", "Java"]
        array << "Grails" //array.add("Grails")
        println array
        println array instanceof ArrayList

        def acoll = ["Groovy", "Java", "Ruby"]
        acoll.each{
            println it
        }
        acoll.each{ v ->
            println v
        }

        println "----------------------------------------"

        def hash = [name:"Andy", "VPN-#":45]
        hash.age = 18
        println hash
        println hash.name

        hash.each{ k, v ->
            println "${k} : ${v}"
        }

        println "----------------------------------------"

        println "plus:" + this.plus(1, 2)
        println "plus:" + this.plus(1)
    }

    static def plus(n, m = 3) {
        n + m //不需要return
    }

}